/****************************************************************************
Copyright (c) 2022-2025 Qualcomm Technologies International, Ltd.
%%version

FILE NAME
    gatt_xpan_client.h

DESCRIPTION
    Header file for the GATT Bluetooth over IP (XPAN) Client library.
*/


/*!
@file    gatt_xpan_client.h
@brief   Header file for the GATT XPAN Client library.

        This file provides documentation for the GATT XPAN Client library
        API (library name: gatt_xpan_client).
*/

#ifndef GATT_XPAN_CLIENT_H
#define GATT_XPAN_CLIENT_H

#include "csr_synergy.h"

#ifndef EXCLUDE_GATT_XPAN_CLIENT_MODULE

#include "csr_types.h"
#include "csr_bt_gatt_lib.h"
#include "csr_list.h"
#include "service_handle.h"
#include "csr_bt_gatt_prim.h"
#include "bluetooth.h"
#include "library.h"
/*!
    \brief GATT XPAN Client status code type.
*/
typedef uint16 GattXpanClientStatus;

/*! { */
/*! Values of the GATT XPAN Client status code. */
#define GATT_XPAN_CLIENT_STATUS_SUCCESS                   (0x0000u) /*!> Request was a success*/
#define GATT_XPAN_CLIENT_STATUS_INVALID_PARAMETER         (0x0001u) /*!> Invalid parameter was supplied*/
#define GATT_XPAN_CLIENT_STATUS_DISCOVERY_ERR             (0x0002u) /*!> Error in discovery of Characteristics*/
#define GATT_XPAN_CLIENT_STATUS_FAILED                    (0x0003u) /*!> Request has failed*/
#define GATT_XPAN_CLIENT_STATUS_INSUFFICIENT_RESOURCES    (0x0004u) /*!> Insufficient Resources to complete
                                                                         the request. */
#define GATT_XPAN_CLIENT_STATUS_READ_ERR                  (0x0005u) /*!> Error in reading of Characteristics*/
/*! } */


/*!
    \brief IDs that the Profile/App uses to distinguish which characteristic a request is acting on
 */
typedef uint8 XpanClientCharacteristicId;

#define GATT_XPAN_CLIENT_STORED_SSID                    ((XpanClientCharacteristicId)  0x00)
#define GATT_XPAN_CLIENT_IPV4_ADDRESS                   ((XpanClientCharacteristicId)  0x01)
#define GATT_XPAN_CLIENT_IPV6_ADDRESS                   ((XpanClientCharacteristicId)  0x02)
#define GATT_XPAN_CLIENT_L2CAP_TCP_PORT                 ((XpanClientCharacteristicId)  0x03)
#define GATT_XPAN_CLIENT_UDP_PORT                       ((XpanClientCharacteristicId)  0x04)
#define GATT_XPAN_CLIENT_MDNS_SRV_UUID                  ((XpanClientCharacteristicId)  0x05)
#define GATT_XPAN_CLIENT_TWT_CONFIGURATION              ((XpanClientCharacteristicId)  0x06)
#define GATT_XPAN_CLIENT_CONNECTED_DEVICES              ((XpanClientCharacteristicId)  0x07)
#define GATT_XPAN_CLIENT_CLEAR_TO_SEND                  ((XpanClientCharacteristicId)  0x08)
#define GATT_XPAN_CLIENT_XPAN_CONTROL_POINT             ((XpanClientCharacteristicId)  0x09)
#define GATT_XPAN_CLIENT_BEARER_PREFERENCE_ADDRESS      ((XpanClientCharacteristicId)  0x0A)
#define GATT_XPAN_CLIENT_MAC_ADDRESS                    ((XpanClientCharacteristicId)  0x0B)
#define GATT_XPAN_CLIENT_REQUESTED_SAP_POWER_STATE      ((XpanClientCharacteristicId)  0x0C)
#define GATT_XPAN_CLIENT_SERVER_FEATURES                ((XpanClientCharacteristicId)  0x0D)
#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_RESPONSE   ((XpanClientCharacteristicId)  0x0E)
#define GATT_XPAN_CLIENT_NUM_DEVICES_PRESENT            ((XpanClientCharacteristicId)  0x0F)
#define GATT_XPAN_CLIENT_VOICE_BACK_CHANNEL_PERIODICITY ((XpanClientCharacteristicId)  0x10)
#define GATT_XPAN_CLIENT_REQUEST_WIFI_SCAN_RESULTS      ((XpanClientCharacteristicId)  0x11)
#define GATT_XPAN_CLIENT_ROAMING_REQUEST_RESPONSE       ((XpanClientCharacteristicId)  0x12)

typedef uint8 XpanClientOpCode;

#define GATT_XPAN_CLIENT_CONNECT_SSID_OPCODE                     ((XpanClientOpCode) 0x01) /* 3.10.1 Connect to a WiFi network                                */
#define GATT_XPAN_CLIENT_DISCONNECT_SSID_OPCODE                  ((XpanClientOpCode) 0x02) /* 3.10.2 Disconnect from the current WiFi network                 */
#define GATT_XPAN_CLIENT_CONNECTED_SSID_OPCODE                   ((XpanClientOpCode) 0x03) /* 3.10.3 WiFi network that the client is connected to.            */
#define GATT_XPAN_CLIENT_AVAILABLE_SSID_OPCODE                   ((XpanClientOpCode) 0x04) /* 3.10.4 Available WiFi network that the server could connect to. */
#define GATT_XPAN_CLIENT_RELATED_SSIDS_OPCODE                    ((XpanClientOpCode) 0x05) /* 3.10.5 Indicate which WiFi networks are related to each other
                                                                                              (i.e. on the same network). */
#define GATT_XPAN_CLIENT_MDNS_SRV_UUID_OPCODE                    ((XpanClientOpCode) 0x06) /* 3.10.6 mDNS SRV UUID that can be used by the server to reconnect
                                                                                              to this device using an XPAN bearer. */
#define GATT_XPAN_CLIENT_REMOVE_SSID_OPCODE                      ((XpanClientOpCode) 0x07) /* 3.10.7 WiFi network that the server should no longer connect to. */
#define GATT_XPAN_CLIENT_L2CAP_TCP_PORT_OPCODE                   ((XpanClientOpCode) 0x08) /* 3.10.8 TCP port number that can be used to connect to the L2CAP
                                                                                              over IP protocol. This shall be connectable using the
                                                                                              exposed IP address. */
#define GATT_XPAN_CLIENT_UDP_PORT_OPCODE                         ((XpanClientOpCode) 0x09) /* 3.10.9 UDP port number that can be used to connect to send AVDTP
                                                                                              media and/or synchronous packets to the client. This shall
                                                                                              be connectable using the exposed IP address. */
#define GATT_XPAN_CLIENT_ETHER_TYPE_OPCODE                       ((XpanClientOpCode) 0x0A) /* 3.10.10 EtherType used for sending AVDTP media over Ether packets. */
#define GATT_XPAN_CLIENT_MAC_ADDRESS_OPCODE                      ((XpanClientOpCode) 0x0B) /* 3.10.11 MAC address of the client. */
#define GATT_XPAN_CLIENT_BEARER_PREFERENCE_RESPONSE_OPCODE       ((XpanClientOpCode) 0x0C) /* 3.10.12 Response to the server's bearer preference. */
#define GATT_XPAN_CLIENT_UPDATE_BEACON_INTERVAL_OPCODE           ((XpanClientOpCode) 0x0D) /* 3.10.13 Update the SAP beacon interval. */
#define GATT_XPAN_CLIENT_SAP_POWER_STATE_RESPONSE_OPCODE         ((XpanClientOpCode) 0x0E) /* 3.10.14 Response to the server's SAP power state request  */
#define GATT_XPAN_CLIENT_CLIENT_FEATURES_OPCODE                  ((XpanClientOpCode) 0x0F) /* 3.10.15 Client's supported features. */
#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_REQUEST_OPCODE      ((XpanClientOpCode) 0x10) /* 3.10.16 Audio bearer switch request. */
#define GATT_XPAN_CLIENT_WIFI_SCAN_RESULTS_OPCODE                ((XpanClientOpCode) 0x11) /* 3.10.17 WiFi Scan Results. */
#define GATT_XPAN_CLIENT_CHANNEL_SWITCH_ANNOUNCEMENT_OPCODE      ((XpanClientOpCode) 0x12) /* 3.10.18 Channel Switch Announcement. */
#define GATT_XPAN_CLIENT_UDP_SYNC_PORT_OPCODE                    ((XpanClientOpCode) 0x13) /* 3.10.19 UDP Sync Port. */
#define GATT_XPAN_CLIENT_ROAMING_REQUEST_OPCODE                  ((XpanClientOpCode) 0x14) /* 3.10.20 Roamign Request. */
#define GATT_XPAN_CLIENT_MULTICAST_MAC_ADDRESS_OPCODE            ((XpanClientOpCode) 0x15) /* 3.10.21 Multicast MAC Address. */

/*!
    \brief IDs of messages a profile task can receive from the
           GATT XPAN Client library.
*/
typedef uint16 GattXpanClientMessageId;

/*! { */
/*! Values for GattXpanClientMessageId */
#define GATT_XPAN_CLIENT_INIT_CFM                                   (GATT_XPAN_CLIENT_MESSAGE_BASE)

#define GATT_XPAN_CLIENT_READ_STORED_SSIDS_CFM                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0001u)
#define GATT_XPAN_CLIENT_READ_IPV4_ADDRESS_CFM                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0002u)
#define GATT_XPAN_CLIENT_READ_IPV6_ADDRESS_CFM                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0003u)
#define GATT_XPAN_CLIENT_READ_L2CAP_TCP_PORT_CFM                                               (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0004u)
#define GATT_XPAN_CLIENT_READ_UDP_PORT_CFM                                                     (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0005u)
#define GATT_XPAN_CLIENT_READ_MDNS_SRV_UUID_CFM                                                (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0006u)
#define GATT_XPAN_CLIENT_READ_TWT_CONFIGURATION_CFM                                            (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0007u)
#define GATT_XPAN_CLIENT_READ_CONNECTED_DEVICES_CFM                                            (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0008u)
#define GATT_XPAN_CLIENT_READ_CLEAR_TO_SEND_CFM                                                (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0009u)
#define GATT_XPAN_CLIENT_READ_BEARER_PREFERENCE_CFM                                            (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Au)
#define GATT_XPAN_CLIENT_READ_MAC_ADDRESS_CFM                                                  (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Bu)
#define GATT_XPAN_CLIENT_READ_REQUESTED_SAP_POWER_STATE_CFM                                    (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Cu)
#define GATT_XPAN_CLIENT_READ_SERVER_FEATURES_CFM                                              (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Du)
#define GATT_XPAN_CLIENT_READ_AUDIO_BEARER_SWITCH_RESPONSE_CFM                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Eu)
#define GATT_XPAN_CLIENT_READ_NUM_DEVICES_PRESENT_CFM                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x000Fu)
#define GATT_XPAN_CLIENT_READ_VOICE_BACK_CHANNEL_PERIODICITY_CFM                               (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0010u)
#define GATT_XPAN_CLIENT_READ_REQUEST_WIFI_SCAN_RESULTS_CFM                                    (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0011u) /* For test only */
#define GATT_XPAN_CLIENT_READ_STORED_SSID_CCC_CFM                                              (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0012u)
#define GATT_XPAN_CLIENT_READ_IPV4_ADDRESS_CCC_CFM                                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0013u)
#define GATT_XPAN_CLIENT_READ_IPV6_ADDRESS_CCC_CFM                                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0014u)
#define GATT_XPAN_CLIENT_READ_L2CAP_TCP_PORT_CCC_CFM                                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0015u)
#define GATT_XPAN_CLIENT_READ_UDP_PORT_CCC_CFM                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0016u)
#define GATT_XPAN_CLIENT_READ_CONNECTED_DEVICES_CCC_CFM                                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0017u)
#define GATT_XPAN_CLIENT_READ_CLEAR_TO_SEND_CCC_CFM                                            (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0018u)
#define GATT_XPAN_CLIENT_READ_BEARER_PREFERENCE_CCC_CFM                                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0019u)
#define GATT_XPAN_CLIENT_READ_MAC_ADDRESS_CCC_CFM                                              (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Au)
#define GATT_XPAN_CLIENT_READ_REQUESTED_SAP_POWER_STATE_CCC_CFM                                (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Bu)
#define GATT_XPAN_CLIENT_READ_SERVER_FEATURES_CCC_CFM                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Cu)
#define GATT_XPAN_CLIENT_READ_AUDIO_BEARER_SWITCH_RESPONSE_CCC_CFM                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Du)
#define GATT_XPAN_CLIENT_READ_NUM_DEVICES_PRESENT_CCC_CFM                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Eu)
#define GATT_XPAN_CLIENT_READ_VOICE_BACK_CHANNEL_PERIODICITY_CCC_CFM                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x001Fu)
#define GATT_XPAN_CLIENT_READ_REQUEST_WIFI_SCAN_RESULTS_CCC_CFM                                (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0020u)
#define GATT_XPAN_CLIENT_READ_ROAMING_REQUEST_RESPONSE_CCC_CFM                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0021u)
#define GATT_XPAN_CLIENT_STORED_SSID_IND                                                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0022u)
#define GATT_XPAN_CLIENT_IPV4_ADDRESS_IND                                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0023u)
#define GATT_XPAN_CLIENT_IPV6_ADDRESS_IND                                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0024u)
#define GATT_XPAN_CLIENT_L2CAP_TCP_PORT_IND                                                    (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0025u)
#define GATT_XPAN_CLIENT_UDP_PORT_IND                                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0026u)
#define GATT_XPAN_CLIENT_MDNS_SRV_UUID_IND                                                     (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0027u)
#define GATT_XPAN_CLIENT_TWT_CONFIGURATION_IND                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0028u)
#define GATT_XPAN_CLIENT_CONNECTED_DEVICES_IND                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0029u)
#define GATT_XPAN_CLIENT_CLEAR_TO_SEND_IND                                                     (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Au)
#define GATT_XPAN_CLIENT_BEARER_PREFERENCE_IND                                                 (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Bu)
#define GATT_XPAN_CLIENT_MAC_ADDRESS_IND                                                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Cu)
#define GATT_XPAN_CLIENT_REQUESTED_SAP_POWER_STATE_IND                                         (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Du)
#define GATT_XPAN_CLIENT_SERVER_FEATURES_IND                                                   (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Eu)
#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_RESPONSE_IND                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x002Fu)
#define GATT_XPAN_CLIENT_NUM_DEVICES_PRESENT_IND                                               (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0030u)
#define GATT_XPAN_CLIENT_VOICE_BACK_CHANNEL_PERIODICITY_IND                                    (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0031u)
#define GATT_XPAN_CLIENT_REQUEST_WIFI_SCAN_RESULTS_IND                                         (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0032u)
#define GATT_XPAN_CLIENT_ROAMING_REQUEST_RESPONSE_IND                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0033u)
#define GATT_XPAN_CLIENT_WRITE_CONNECT_SSID_OPCODE_CFM                                         (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0034u)
#define GATT_XPAN_CLIENT_WRITE_DISCONNECT_SSID_OPCODE_CFM                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0035u)
#define GATT_XPAN_CLIENT_WRITE_CONNECTED_SSID_OPCODE_CFM                                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0036u)
#define GATT_XPAN_CLIENT_WRITE_AVAILABLE_SSID_OPCODE_CFM                                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0037u)
#define GATT_XPAN_CLIENT_WRITE_RELATED_SSIDS_OPCODE_CFM                                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0038u)
#define GATT_XPAN_CLIENT_WRITE_MDNS_SRV_UUID_OPCODE_CFM                                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0039u)
#define GATT_XPAN_CLIENT_WRITE_REMOVE_SSID_OPCODE_CFM                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Au)
#define GATT_XPAN_CLIENT_WRITE_L2CAP_TCP_PORT_OPCODE_CFM                                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Bu)
#define GATT_XPAN_CLIENT_WRITE_UDP_PORT_OPCODE_CFM                                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Cu)
#define GATT_XPAN_CLIENT_WRITE_ETHER_TYPE_OPCODE_CFM                                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Du)
#define GATT_XPAN_CLIENT_WRITE_MAC_ADDRESS_OPCODE_CFM                                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Eu)
#define GATT_XPAN_CLIENT_WRITE_BEARER_PREFERENCE_RESPONSE_OPCODE_CFM                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x003Fu)
#define GATT_XPAN_CLIENT_WRITE_UPDATE_BEACON_PARAMETERS_OPCODE_CFM                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0040u)
#define GATT_XPAN_CLIENT_WRITE_SAP_POWER_STATE_RESPONSE_OPCODE_CFM                             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0041u)
#define GATT_XPAN_CLIENT_WRITE_CLIENT_FEATURES_OPCODE_CFM                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0042u)
#define GATT_XPAN_CLIENT_WRITE_AUDIO_BEARER_SWITCH_REQUEST_OPCODE_CFM                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0043u)
#define GATT_XPAN_CLIENT_WRITE_WIFI_SCAN_RESULTS_OPCODE_CFM                                    (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0044u)
#define GATT_XPAN_CLIENT_WRITE_CHANNEL_SWITCH_ANNOUNCEMENT_OPCODE_CFM                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0045u)
#define GATT_XPAN_CLIENT_WRITE_UDP_SYNC_PORT_OPCODE_CFM                                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0046u)
#define GATT_XPAN_CLIENT_WRITE_ROAMING_REQUEST_OPCODE_CFM                                      (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0047u)
#define GATT_XPAN_CLIENT_WRITE_MULTICAST_MAC_ADDRESS_OPCODE_CFM                                (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0048u)
#define GATT_XPAN_CLIENT_WRITE_TWT_CONFIGURATION_CFM                                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0049u)
#define GATT_XPAN_CLIENT_STORED_SSID_CCC_HANDLE_SET_NOTIFICATION_CFM                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Au)
#define GATT_XPAN_CLIENT_IPV4_ADDRESS_CCC_HANDLE_SET_NOTIFICATION_CFM                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Bu)
#define GATT_XPAN_CLIENT_IPV6_ADDRESS_CCC_HANDLE_SET_NOTIFICATION_CFM                          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Cu)
#define GATT_XPAN_CLIENT_L2CAP_TCP_PORT_CCC_HANDLE_SET_NOTIFICATION_CFM                        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Du)
#define GATT_XPAN_CLIENT_UDP_PORT_CCC_HANDLE_SET_NOTIFICATION_CFM                              (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Eu)
#define GATT_XPAN_CLIENT_CONNECTED_DEVICES_CCC_HANDLE_SET_NOTIFICATION_CFM                     (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x004Fu)
#define GATT_XPAN_CLIENT_CLEAR_TO_SEND_CCC_HANDLE_SET_NOTIFICATION_CFM                         (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0050u)
#define GATT_XPAN_CLIENT_BEARER_PREFERENCE_CCC_HANDLE_SET_NOTIFICATION_CFM                     (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0051u)
#define GATT_XPAN_CLIENT_MAC_ADDRESS_CCC_HANDLE_SET_NOTIFICATION_CFM                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0052u)
#define GATT_XPAN_CLIENT_REQUESTED_SAP_POWER_STATE_CCC_HANDLE_SET_NOTIFICATION_CFM             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0053u)
#define GATT_XPAN_CLIENT_SERVER_FEATURES_CCC_HANDLE_SET_NOTIFICATION_CFM                       (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0054u)
#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_RESPONSE_CCC_HANDLE_SET_NOTIFICATION_CFM          (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0055u)
#define GATT_XPAN_CLIENT_NUM_DEVICES_PRESENT_CCC_HANDLE_SET_NOTIFICATION_CFM                   (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0056u)
#define GATT_XPAN_CLIENT_VOICE_BACK_CHANNEL_PERIODICITY_CCC_HANDLE_SET_NOTIFICATION_CFM        (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0057u)
#define GATT_XPAN_CLIENT_REQUEST_WIFI_SCAN_RESULTS_CCC_HANDLE_SET_NOTIFICATION_CFM             (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0058u)
#define GATT_XPAN_CLIENT_ROAMING_REQUEST_RESPONSE_CCC_HANDLE_SET_NOTIFICATION_CFM              (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x0059u)
#define GATT_XPAN_CLIENT_TERMINATE_CFM                                                         (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x005Au)
#define GATT_XPAN_CLIENT_MESSAGE_TOP                                                           (GATT_XPAN_CLIENT_MESSAGE_BASE + 0x005Bu)
/*! } */

#define XPAN_CLIENT_BSSID_LEN                     (6)
#define XPAN_CLIENT_TSF_TIMESTAMP_LENGTH          (8)

#define WIFI_SCAN_RESULTS_GLOBAL_FIELDS     (1 + /* octet : opcode      */ \
                                             8 + /* octets: time stamp  */ \
                                             1   /* octets: num BSSIDs  */ )

#define WIFI_SCAN_RESULTS_SINGLE_AP_RESULT_SIZE    (1 + /* octets: SSID len                                            */ \
                                                    0 + /* octets: Worst case (is an empty SSID really a valid value)? */ \
                                                    6 + /* octets: bssid                                               */ \
                                                    2 + /* octets: channel                                             */ \
                                                    1 + /* octets: sec mode                                            */ \
                                                    1   /* octets: rssi                                                */ )
/*
 * Note: ATT currently limits Long Writes to 250 octets.
 */
#define ATT_MAX_PDU_SIZE                    (250)

#define XPAN_CLIENT_WIFI_SCAN_RESULT_NUM_APS_MAX   ((ATT_MAX_PDU_SIZE - WIFI_SCAN_RESULTS_GLOBAL_FIELDS)/WIFI_SCAN_RESULTS_SINGLE_AP_RESULT_SIZE)
#define XPAN_CLIENT_SSID_MAX_LENGTH                (32)

#define XPAN_CLIENT_PASSPHRASE_MAX_LENGTH          (63)

/*!
    @brief Parameters used by the Initialization API
*/
typedef struct
{
     connection_id_t cid;      /*! Connection ID. */
     uint16 startHandle;       /*! The first handle of the service that needs to be accessed */
     uint16 endHandle;         /*! The last handle of the service that needs to be accessed */
} GattXpanClientInitData;


/*!
    @brief Handles of the XPAN characteristics.
*/
typedef struct
{
    uint16 storedSsidHandle;
    uint16 Ipv4AddressHandle;
    uint16 Ipv6AddressHandle;
    uint16 L2capTcpPortHandle;
    uint16 UdpPortHandle;
    uint16 MDnsSrvUuidHandle;
    uint16 TwtConfigurationHandle;
    uint16 ConnectedDevicesHandle;
    uint16 ClearToSendHandle;
    uint16 controlPointHandle;
    uint16 BearerPreferenceHandle;
    uint16 MacAddressHandle;
    uint16 RequestedSapPowerStateHandle;
    uint16 serverFeaturesHandle;
    uint16 audioBearerSwitchResponseHandle;
    uint16 numDevicesPresentHandle;
    uint16 voiceBackChannelPeriodicityHandle;
    uint16 requestWiFiScanResultsHandle;
    uint16 roamingRequestResponseHandle;

    uint16 storedSsidCccHandle;
    uint16 Ipv4AddressCccHandle;
    uint16 Ipv6AddressCccHandle;
    uint16 L2capTcpPortCccHandle;
    uint16 UdpPortCccHandle;
    uint16 ConnectedDevicesCccHandle;
    uint16 ClearToSendCccHandle;
    uint16 BearerPreferenceCccHandle;
    uint16 MacAddressCccHandle;
    uint16 RequestedSapPowerStateCccHandle;
    uint16 serverFeaturesCccHandle;
    uint16 audioBearerSwitchResponseCccHandle;
    uint16 numDevicesPresentCccHandle;
    uint16 voiceBackChannelPeriodicityCccHandle;
    uint16 requestWiFiScanResultsCccHandle;
    uint16 roamingRequestResponseCccHandle;

} GattXpanClientDeviceData;

/*!
    @brief Gatt client library message sent as a result of calling the GattXpanClientInitReq API.
*/
typedef struct
{
    GattXpanClientMessageId id;   /*! service message id */
    ServiceHandle clntHndl;       /*! Reference handle for the instance */
    connection_id_t  cid;         /*! Connection ID */
    GattXpanClientStatus status;  /*! Status of the initialization attempt */
} GattXpanClientInitCfm;


typedef uint8 GattXpanClientIpAddressStatus;
#define IPV4_ADDRESS_OBTAINED_SUCCESSFULLY              ((GattXpanClientIpv4AddressStatus) 0x00)
#define IPV4_ADDRESS_FAILED_TO_OBTAIN_ADDRESS           ((GattXpanClientIpv4AddressStatus) 0x01)
#define IPV4_ADDRESS_FAILED_TO_CONNECT_TO_SSID          ((GattXpanClientIpv4AddressStatus) 0x01)

typedef uint8 GattXpanClientIpAddressRole;
#define IPV4_ADDRESS_PRIMARY                            ((GattXpanClientIpv4AddressRole)   0x00)
#define IPV4_ADDRESS_SECONDARY                          ((GattXpanClientIpv4AddressRole)   0x01)

typedef uint8 GattXpanClientAudioLocation;
#define XPAN_CLIENT_AUDIO_LOC_FRONT_LEFT                ((GattXpanClientAudioLocation) ( 0))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_RIGHT               ((GattXpanClientAudioLocation) ( 1))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_CENTER              ((GattXpanClientAudioLocation) ( 2))
#define XPAN_CLIENT_AUDIO_LOC_LOW_FREQUENCY_EFFECTS_1   ((GattXpanClientAudioLocation) ( 3))
#define XPAN_CLIENT_AUDIO_LOC_BACK_LEFT                 ((GattXpanClientAudioLocation) ( 4))
#define XPAN_CLIENT_AUDIO_LOC_BACK_RIGHT                ((GattXpanClientAudioLocation) ( 5))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_LEFT_OF_CENTER      ((GattXpanClientAudioLocation) ( 6))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_RIGHT_OF_CENTER     ((GattXpanClientAudioLocation) ( 7))
#define XPAN_CLIENT_AUDIO_LOC_BACK_CENTER               ((GattXpanClientAudioLocation) ( 8))
#define XPAN_CLIENT_AUDIO_LOC_LOW_FREQUENCY_EFFECTS_2   ((GattXpanClientAudioLocation) ( 9))
#define XPAN_CLIENT_AUDIO_LOC_SIDE_LEFT                 ((GattXpanClientAudioLocation) (10))
#define XPAN_CLIENT_AUDIO_LOC_SIDE_RIGHT                ((GattXpanClientAudioLocation) (11))
#define XPAN_CLIENT_AUDIO_LOC_TOP_FRONT_LEFT            ((GattXpanClientAudioLocation) (12))
#define XPAN_CLIENT_AUDIO_LOC_TOP_FRONT_RIGHT           ((GattXpanClientAudioLocation) (13))
#define XPAN_CLIENT_AUDIO_LOC_TOP_FRONT_CENTER          ((GattXpanClientAudioLocation) (14))
#define XPAN_CLIENT_AUDIO_LOC_TOP_CENTER                ((GattXpanClientAudioLocation) (15))
#define XPAN_CLIENT_AUDIO_LOC_TOP_BACK_LEFT             ((GattXpanClientAudioLocation) (16))
#define XPAN_CLIENT_AUDIO_LOC_TOP_BACK_RIGHT            ((GattXpanClientAudioLocation) (17))
#define XPAN_CLIENT_AUDIO_LOC_TOP_SIDE_LEFT             ((GattXpanClientAudioLocation) (18))
#define XPAN_CLIENT_AUDIO_LOC_TOP_SIDE_RIGHT            ((GattXpanClientAudioLocation) (19))
#define XPAN_CLIENT_AUDIO_LOC_TOP_BACK_CENTER           ((GattXpanClientAudioLocation) (20))
#define XPAN_CLIENT_AUDIO_LOC_BOTTOM_FRONT_CENTER       ((GattXpanClientAudioLocation) (21))
#define XPAN_CLIENT_AUDIO_LOC_BOTTOM_FRONT_LEFT         ((GattXpanClientAudioLocation) (22))
#define XPAN_CLIENT_AUDIO_LOC_BOTTOM_FRONT_RIGHT        ((GattXpanClientAudioLocation) (23))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_LEFT_WIDE           ((GattXpanClientAudioLocation) (24))
#define XPAN_CLIENT_AUDIO_LOC_FRONT_RIGHT_WIDE          ((GattXpanClientAudioLocation) (25))
#define XPAN_CLIENT_AUDIO_LOC_LEFT_SURROUND             ((GattXpanClientAudioLocation) (26))
#define XPAN_CLIENT_AUDIO_LOC_RIGHT_SURROUND            ((GattXpanClientAudioLocation) (27))

#define XPAN_CLIENT_MDNS_SRV_UUID_LENGTH_OCTETS        16
#define XPAN_CLIENT_IPV4_ADDRESS_LENGTH_OCTETS          4
#define XPAN_CLIENT_IPV6_ADDRESS_LENGTH_OCTETS         16
#define XPAN_CLIENT_MAC_ADDRESS_LENGTH_OCTETS           6
#define XPAN_CLIENT_AUDIO_LOC_LENGTH_OCTETS             4
#define XPAN_CLIENT_COUNTRY_STRING_LENGTH_OCTETS        3
#define XPAN_CLIENT_BSSID_LENGTH_OCTETS                 6
#define XPAN_CLIENT_TBTT_TSF_LENGTH_OCTETS              8

typedef uint8 XpanClientSecurityMode;
#define XPAN_CLIENT_SECURITY_MODE_OPEN              ((XpanClientSecurityMode) (0x00))
#define XPAN_CLIENT_SECURITY_MODE_WEP               ((XpanClientSecurityMode) (0x01))
#define XPAN_CLIENT_SECURITY_MODE_WPA               ((XpanClientSecurityMode) (0x02))
#define XPAN_CLIENT_SECURITY_MODE_WPA2              ((XpanClientSecurityMode) (0x03))
#define XPAN_CLIENT_SECURITY_MODE_MIXED_MODE        ((XpanClientSecurityMode) (0x04))
#define XPAN_CLIENT_SECURITY_MODE_WPA3              ((XpanClientSecurityMode) (0x05))
#define XPAN_CLIENT_SECURITY_MODE_WPA3_TRANSITION   ((XpanClientSecurityMode) (0x06))
#define XPAN_CLIENT_SECURITY_MODE_ANY_SECURITY      ((XpanClientSecurityMode) (0x07))
#define XPAN_CLIENT_SECURITY_MODE_UNKNOWN_SECURITY  ((XpanClientSecurityMode) (0x08))

typedef uint8  XpanClientBearerPreferenceStatus;
#define XPAN_CLIENT_BEARER_PREFERENCE_STATUS_ACCEPTED     ((XpanClientBearerPreferenceStatus)(0x00))
#define XPAN_CLIENT_BEARER_PREFERENCE_STATUS_REJECTED     ((XpanClientBearerPreferenceStatus)(0x01))

typedef uint8  XpanClientSapPowerStateStatus;
#define XPAN_CLIENT_SAP_POWER_STATE_STATUS_ACCEPTED     ((XpanClientSapPowerStateStatus)(0x00))
#define XPAN_CLIENT_SAP_POWER_STATE_STATUS_REJECTED     ((XpanClientSapPowerStateStatus)(0x01))


/*! @brief An individual SSID structure, the GATT_XPAN_CLIENT_READ_STORED_SSIDS_CFM may contain
    multiple of these.
 */
typedef struct
{
    uint8 length;   /*! The number of octets pointed to by the 'ssid' field. */
    uint8* value;    /*! The value of the SSID. The memory pointed to must be freed by the Application. */
} GattXpanClientBufferWithLength;

/*
 *  SSID                Length 1 Octet                  The length of the SSID field
    SSID                SSID Length Octets              The SSID string
    Passphrase          Length 1 Octet                  The length of the Passphrase field
    Passphrase          Passphrase Length Octets        The Passphrase used to authenticate the device to the network
    BSSID               6 Octets                        BSSID of the Access Point
    Center Frequency    2 Octets                        Center frequency (in MHz whole number only) on which the Access Point is operating.
    Security Mode       1 Octet                         0x00 = Open
                                                        0x01 = WEP
                                                        0x02 = WPA
                                                        0x03 = WPA2
                                                        0x04 = Mixed Mode
                                                        0x05 = WPA3
                                                        0x06 = WPA3 transition
                                                        0x07 = Any security mode
                                                        0x08 = Unknown security
                                                        Others = Reserved
    Country String      3 Octets                        Set to the value contained in the dot11CountryString attribute in IEEE
 */
typedef struct GattXpanClientConnectSsidOp
{
    GattXpanClientBufferWithLength ssid;                             /* The SSID string */
    GattXpanClientBufferWithLength passphrase;                       /* The Passphrase used to authenticate the device to the network */
    uint8 bssid[XPAN_CLIENT_BSSID_LENGTH_OCTETS];                    /* BSSID of the Access Point */
    uint16 primaryFrequencyMhz;                                      /* Primary frequency (in MHz whole number only) on which the Access Point is operating. */
    XpanClientSecurityMode  securityMode;
    uint8  countryString[XPAN_CLIENT_COUNTRY_STRING_LENGTH_OCTETS];  /* Set to the value contained in the dot11CountryString attribute in IEEE */
} GattXpanClientConnectSsidOp;

typedef struct GattXpanClientConnectSsidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientConnectSsidOp connectSsidOp;      /* The Connect SSID Operation structure that is used to write this opcode and in opcode notifications */
} GattXpanClientConnectSsidOpcodeInd;

/*
 * SSID Length          1 Octet                     The length of the SSID field
   SSID                 SSID Length Octets          The SSID string
 */
typedef struct GattXpanClientDisconnectSsidOp
{
    GattXpanClientBufferWithLength ssid;                        /* The SSID string */
} GattXpanClientDisconnectSsidOp;

typedef struct GattXpanClientDisconnectSsidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientDisconnectSsidOp disconnectSsidOp;
} GattXpanClientDisconnectSsidOpcodeInd;

/*
 *  SSID Length             1 Octet                 The length of the SSID field
 *  SSID                    SSID Length Octets      The SSID string
    BSSID                   6 Octets                BSSID of the Access Point
    Center Frequency        2 ctets                 Center frequency (in MHz whole number only) on which the Access Point is operating.
    IPv4 Address            4 Octets                IPv4 address of the client
    IPv6 Address            16 Octets               IPv6 address of the client
    MAC Address             6 octets
 */
typedef struct GattXpanClientConnectedSsidOp
{
    GattXpanClientBufferWithLength ssid;                         /* The SSID string */
    uint8 bssid[XPAN_CLIENT_BSSID_LENGTH_OCTETS];                /* BSSID of the Access Point */
    uint16 primaryFrequencyMhz;                                  /* Primary frequency (in MHz whole number only) on which the Access Point is operating. */
    uint8 ipv4Address[XPAN_CLIENT_IPV4_ADDRESS_LENGTH_OCTETS];
    uint8 ipv6Address[XPAN_CLIENT_IPV6_ADDRESS_LENGTH_OCTETS];
    uint8 macAddress[XPAN_CLIENT_MAC_ADDRESS_LENGTH_OCTETS];
    GattXpanClientBufferWithLength passphrase;
    uint8 securityMode;
    uint8 countryString[XPAN_CLIENT_COUNTRY_STRING_LENGTH_OCTETS];
} GattXpanClientConnectedSsidOp;

typedef struct GattXpanClientConnectedSsidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientConnectedSsidOp connectedSsidOp;
} GattXpanClientConnectedSsidOpcodeInd;

typedef struct GattXpanClientBssData
{
    uint8 bssid[XPAN_CLIENT_BSSID_LENGTH_OCTETS];    /* BSSID of the Access Point */
    uint16 primaryFrequencyMhz;                      /* Primary frequency (in MHz whole number only) on which the Access Point is operating. */
} GattXpanClientBssData;
/*
 *      SSID Length             1 Octets                   The length of the SSID field
        SSID                    SSID Length Octets         The SSID string
        Passphrase Length       1 Octet                    The length of the Passphrase field
        Passphrase              Passphrase Length Octets   The Passphrase used to authenticate the device to the network
        Security Mode           1 Octet                    0x00 = Open
                                                           0x01 = WEP
                                                           0x02 = WPA
                                                           0x03 = WPA2
                                                           0x04 = Mixed Mode
                                                           0x05 = WPA3
                                                           0x06 = WPA3 transition
                                                           0x07 = Any security mode
                                                           0x08 = Unknown security
                                                           Others = Reserved
        Num BSSID               1 Octet                    Number of BSSIDs
        BSSID[i]                6 Octets                   BSSID of the Access Point
        Center Frequency[i]     2 Octets                   Center frequency (in MHz whole number only) on which the Access Point is operating.
 */
typedef struct GattXpanClientAvailableSsidOp
{
    GattXpanClientBufferWithLength ssid;                        /* The SSID string */
    GattXpanClientBufferWithLength passphrase;                  /* The Passphrase used to authenticate the device to the network */
    XpanClientSecurityMode  securityMode;
    uint8 numBssids;
    GattXpanClientBssData *bssData;                             /* pointer to an array of BSSIDs and their corresponding Center Frequencies */
} GattXpanClientAvailableSsidOp;

typedef struct GattXpanClientAvailableSsidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientAvailableSsidOp availableSsidOp;
} GattXpanClientAvailableSsidOpcodeInd;

/*
 *  Num SSIDs           1 Octet                 Number of SSIDs
    SSID Length[i]      1 Octet                 The length of the SSID[i] field
    SSID[i]             SSID Length[i] Octets   The SSID string
 */
typedef struct GattXpanClientRelatedSsidsOp
{
    uint8 numSsids;
    GattXpanClientBufferWithLength *ssid;
} GattXpanClientRelatedSsidsOp;

typedef struct GattXpanClientRelatedSsidsOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientRelatedSsidsOp relatedSsidsOp;
} GattXpanClientRelatedSsidsOpcodeInd;

typedef struct GattXpanClientMdnsSrvUuidOp
{
    uint8 mDnsSrvUuid[XPAN_CLIENT_MDNS_SRV_UUID_LENGTH_OCTETS];
} GattXpanClientMdnsSrvUuidOp;

typedef struct GattXpanClientMdnsSrvUuidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientMdnsSrvUuidOp mdnsSrvUuidOp;
} GattXpanClientMdnsSrvUuidOpcodeInd;

typedef struct GattXpanClientRemoveSsidOp
{
    GattXpanClientBufferWithLength ssid;
} GattXpanClientRemoveSsidOp;

typedef struct GattXpanClientRemoveSsidOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientRemoveSsidOp removeSsidOp;
} GattXpanClientRemoveSsidOpcodeInd;

typedef struct GattXpanClientL2capTcpPortOp
{
    uint16 l2capTcpPort;
} GattXpanClientL2capTcpPortOp;

typedef struct GattXpanClientL2capTcpPortOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientL2capTcpPortOp l2capTcpPortOp;
} GattXpanClientL2capTcpPortOpcodeInd;

typedef struct GattXpanClientUdpPortOp
{
    uint16  udpPortAudio;          /* UDP port number for sending audio data to the client */
    uint16  udpPortReports;        /* UDP port number for sending periodic reports to the client */
} GattXpanClientUdpPortOp;

typedef struct GattXpanClientUdpPortOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientUdpPortOp udpPortOp;
} GattXpanClientUdpPortOpcodeInd;

typedef struct GattXpanClientEtherTypeOp
{
    uint16 etherType;
} GattXpanClientEtherTypeOp;

typedef struct GattXpanClientEtherTypeOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientEtherTypeOp etherTypeOp;
} GattXpanClientEtherTypeOpcodeInd;

typedef struct GattXpanClientMacAddressOp
{
    uint8 macAddress[XPAN_CLIENT_MAC_ADDRESS_LENGTH_OCTETS];
} GattXpanClientMacAddressOp;

typedef struct GattXpanClientMacAddressOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientMacAddressOp macAddressOp;
} GattXpanClientMacAddressOpcodeInd;

typedef struct GattXpanClientBearerPreferenceResponseOp
{
    /*
        Status          1 Octet             0x00 = Bearer preference accepted
                                            0x01 = Bearer preference rejected
                                            Others = Reserved
    */
    XpanClientBearerPreferenceStatus status;
} GattXpanClientBearerPreferenceResponseOp;

typedef struct GattXpanClientBearerPreferenceResponseOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientBearerPreferenceResponseOp bearerPreferenceResponseOp;
} GattXpanClientBearerPreferenceResponseOpcodeInd;

typedef struct GattXpanClientUpdateBeaconParametersOp
{
    /*
     *  Next TBTT TSF               8 Octets                Time, in microseconds, of the Target Beacon Transmission Time
                                                            (TBTT) with reference to the Time Synchronization Function (TSF).
    */
    uint8 nextTbttTsfMicroSeconds[XPAN_CLIENT_TBTT_TSF_LENGTH_OCTETS];
    /*
        Beacon Interval             2 Octets                New beacon interval multiplier.
     */
    uint16 beaconIntervalMultiplier;
    /*
        Center Frequency             2 Octets                Center Frequency (in MHz, whole number only).
     */
    uint16 primaryFrequency;
} GattXpanClientUpdateBeaconParametersOp;

typedef struct GattXpanClientUpdateBeaconParametersOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;
    GattXpanClientUpdateBeaconParametersOp updateBeaconParametersOp;
} GattXpanClientUpdateBeaconParametersOpcodeInd;

typedef struct GattXpanClientSapPowerStateResponseOp
{
    /*
     * Status               1 Octet                 0x00 = Requested SAP power state accepted
                                                    0x01 = Requested SAP power state rejected
                                                    Others = Reserved
     */
    XpanClientSapPowerStateStatus status;
} GattXpanClientSapPowerStateResponseOp;

#define XPAN_CLIENT_CLIENT_FEATURES_LEN                         8

typedef struct GattXpanClientClientFeatures
{
    uint8 value[XPAN_CLIENT_CLIENT_FEATURES_LEN];  /* Client Features   8 Octets    Bit 0: XPAN 2.4 GHz bearer
                                                                                    Bit 1: XPAN 5 GHz bearer
                                                                                    Bit 2: XPAN 6 GHz bearer
                                                                                    Bit 3: XPAN point to point topology
                                                                                    Bit 4: XPAN access point topology
                                                                                    Bit 5: XPAN P2P audio bearer
                                                                                    Bit 6: XPAN AP audio bearer
                                                                                    Bit 7: Bearer switch between Bluetooth and 2.4 GHz AP
                                                                                    Bit 8: Bearer switch between Bluetooth and 5 GHz (or higher) AP
                                                                                    Bit 9: Audio bearer switch between Bluetooth and SAP
                                                                                    Bit 10: Bearer switch between 2.4 GHz AP and 5 GHz (or higher) AP
                                                                                    Bit 11: Full bearer switch during an LE audio stream
                                                                                    Bit 12: Switch primary procedure
                                                                                    Bit 13: TLS
                                                                                    Bit 14: DTLS
                                                                                    Bit 15: Voice call over XPAN P2P bearer
                                                                                    Bit 16: mDNS
                                                                                    Others: Reserved
                                                    */
} GattXpanClientClientFeatures;

typedef struct GattXpanClientClientFeaturesOp
{
    GattXpanClientClientFeatures clientFeatures;
} GattXpanClientClientFeaturesOp;

typedef uint8 GattXpanClientAudioBearerSwitchRequest;

#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_REQUEST_BLUETOOTH       ((GattXpanClientAudioBearerSwitchRequest) 0x00)
#define GATT_XPAN_CLIENT_AUDIO_BEARER_SWITCH_REQUEST_XPAN_P2P        ((GattXpanClientAudioBearerSwitchRequest) 0x01)

typedef struct GattXpanAudioBearerSwitchRequestOp
{
    GattXpanClientAudioBearerSwitchRequest audioBearerSwitchRequest;
} GattXpanClientAudioBearerSwitchRequestOp;

typedef uint8 GattXpanClientSecurityMode;
typedef struct
{
    uint8                      bssid[XPAN_CLIENT_BSSID_LEN];
    uint8                      ssidLength;
    uint8*                     ssid;
    uint16                     channelMHz;
    GattXpanClientSecurityMode securityMode;
    int8                       rssi;
} XpanClientApScanResult;

/*! @brief Contents of the GATT_XPAN_SERVER_WIFI_SCAN_RESULTS_IND message that is sent by the XPAN Service library
           when it receives a WiFi Scan Results opcode from the Handset.
           In theory the number of ApScanResults can be GATT_XPAN_SERVER_WIFI_SCAN_RESULT_NUM_APS_MAX, so we need
           to cater for this, just in case someone is trying to break things.
 */
typedef struct GattXpanClientWiFiScanResults
{
    uint8                   scanTimestamp[XPAN_CLIENT_TSF_TIMESTAMP_LENGTH];
    uint8                   numBssids;    /*! This corresponds to the number of ApScanResults */
    XpanClientApScanResult* apScanResult[1];
} GattXpanClientWiFiScanResults;

typedef GattXpanClientWiFiScanResults GattXpanClientWiFiScanResultsOp;

/*
typedef struct GattXpanClientWiFiScanResultsOp
{
    uint8                   scanTimestamp[XPAN_CLIENT_WIFI_SCAN_TIMESTAMP_LENGTH];
    uint8                   numBssids;    *! This corresponds to the number of ApScanResults *
    XpanClientApScanResult* apScanResult[];
} GattXpanClientWiFiScanResultsOp;
*/

typedef struct GattXpanClientChannelSwitchAnnouncementOp
{
    uint16 primaryFrequencyMHz;
    uint8 targetTsf[XPAN_CLIENT_TSF_TIMESTAMP_LENGTH];
    uint8 bandwidthMHz;
} GattXpanClientChannelSwitchAnnouncementOp;

typedef struct GattXpanClientUdpSyncPortOp
{
    uint16 udpSyncPort;
} GattXpanClientUdpSyncPortOp;

typedef struct GattXpanClientMulticastMacAddressOp
{
    uint8 multicastMacAddress[XPAN_CLIENT_MAC_ADDRESS_LENGTH_OCTETS];
} GattXpanClientMulticastMacAddressOp;

typedef struct GattXpanClientSapPowerStateResponseOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientSapPowerStateResponseOp sapPowerStateResponseOp;
} GattXpanClientSapPowerStateResponseOpcodeInd;

typedef struct GattXpanClientClientFeaturesOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientClientFeaturesOp clientFeaturesOp;
} GattXpanClientClientFeaturesOpcodeInd;

typedef struct GattXpanClientAudioBearerSwitchRequestOpcodeInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientAudioBearerSwitchRequestOp audioBearerSwitchRequestOp;
} GattXpanClientAudioBearerSwitchRequestOpcodeInd;

typedef struct GattXpanClientStoredSsid
{
    uint8                   numSsids;   /*! The number of SSIDs contained in this confirmation. */
    GattXpanClientBufferWithLength*     ssids;      /*! A pointer to the array of SSIDs. */
} GattXpanClientStoredSsid;

typedef struct GattXpanClientStoredSsidInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientStoredSsid storedSsid;
} GattXpanClientStoredSsidInd;

typedef struct
{
    GattXpanClientIpAddressStatus   status;
    GattXpanClientBufferWithLength  ipAddress;
    uint8                           audioLocation[XPAN_CLIENT_AUDIO_LOC_LENGTH_OCTETS];
    GattXpanClientIpAddressRole     role;
    uint8                           macAddress[XPAN_CLIENT_MAC_ADDRESS_LENGTH_OCTETS];
} GattXpanClientIpAddress;

typedef struct
{
    GattXpanClientBufferWithLength          ssid;
    uint8                       bssid[XPAN_CLIENT_BSSID_LENGTH_OCTETS];
    uint8                       numIpAddresses;
    GattXpanClientIpAddress*    ipAddresses;
} GattXpanClientIpAddressSsidData;

typedef struct
{
    /*
     * QBCESPEC 4/4/2023
     * Num SSIDs                1 Octet     Total number of SSIDs
       SSID Length[i]           1 Octet     The length of the SSID[i] field
       SSID[i]                  SSID Length[i] Octets
       BSSID[i]                 6 Octets    BSSID
       Num IPv4 Addresses[i]    1 Octet     Total number of IPv4 addresses
       Status[j]                1 Octet
       IP Address[j]            4 Octets    IPv4 Address
       Audio Location[j]        4 Octets    Audio Location associated with IP Address[j]
       Role[j]                  1 Octet     Role associated with IP Address[j]
       MAC Address[j]           6 Octets    MAC address associated with IP Address[j]
     */
    uint8                            numSsids;   /*! The number of SSIDs contained in this confirmation. */
    GattXpanClientIpAddressSsidData* ssidData;
} GattXpanClientIpAddressData;

typedef struct GattXpanClientIpv4AddressInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientIpAddressData ipAddressData;
} GattXpanClientIpv4AddressInd;

typedef struct GattXpanClientIpv6AddressInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientIpAddressData ipAddressData;
} GattXpanClientIpv6AddressInd;

typedef uint16 GattXpanClientL2capTcpPort;

typedef struct GattXpanClientL2capTcpPortInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientL2capTcpPort l2capTcpPort;
} GattXpanClientL2capTcpPortInd;

typedef uint16 GattXpanClientUdpPort;

typedef struct GattXpanClientUdpPortInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientUdpPort udpPort;
} GattXpanClientUdpPortInd;

typedef struct GattXpanClientRoamingRequestResponseInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;
    GattXpanClientStatus status;
} GattXpanClientRoamingRequestResponseInd;

#define GATT_XPAN_CLIENT_READ_TWT_CONFIG_TSF_LEFT_LEN            0x08

/*
 *  Bit Position: 0
    Negotiation Type                  1 Bit               0 = Individual TWT
                                                          1 = Broadcast TWT
*/
#define GATT_XPAN_CLIENT_NEGOTIATION_TYPE_INDIVIDUAL_TWT            0x00
#define GATT_XPAN_CLIENT_NEGOTIATION_TYPE_BROADCAST_TWT             0x01
/*
 *  Bit Position: 1
    Flow Type                         1 Bit               0 = Announced
                                                          1 = Unannounced
*/
#define GATT_XPAN_CLIENT_FLOW_TYPE_ANNOUNCED                        0x00
#define GATT_XPAN_CLIENT_FLOW_TYPE_UNANNOUNCED                      0x02
/*
 *  Bit Position: 2
    Trigger Type                      1 Bit               0 = NonTrigger enabled
                                                          1 = Trigger enabled
*/
#define GATT_XPAN_CLIENT_TRIGGER_TYPE_NON_TRIGGER_ENABLED           0x00
#define GATT_XPAN_CLIENT_TRIGGER_TYPE_TRIGGER_ENABLED               0x04

typedef struct
{
    uint8                   setupId;    /*! Unique ID representing a TWT session. Nonzero integer. */
    uint8                   flags;      /*! Flags: |bits 7-3: RFU|bit 2: TriggerType|bit 1: FlowType|bit 0: NegotiationType| */

/*! Value in microseconds. May be set to the same value as the
    Desired Wake Interval field if early termination is used.*/
    uint32                  desiredWakeDuration;

/*! Value in microseconds. This field shall be set to a valid value. */
    uint32                  desiredWakeInterval;

/*! Time, in microseconds, when the first TWT starts for the
    Primary earbud with reference to the TSF. Set to 0 to indicate
    that it is not valid in which case the time when the first
    TWT starts is retrieved from the WiFi subsystem. */
    uint8                   desiredWakeTsfLeft[GATT_XPAN_CLIENT_READ_TWT_CONFIG_TSF_LEFT_LEN];

/*! Offset, in microseconds, from Desired Wake TSF Primary when
    the TWT starts for the Secondary earbud. This field shall be
    set to a valid value */
    uint32                  desiredWakeTsfRightOffset;
} GattXpanClientTwtConfiguration;

typedef struct GattXpanClientTwtConfigurationInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;
    GattXpanClientTwtConfiguration  twtConfiguration;
} GattXpanClientTwtConfigurationInd;

typedef struct GattXpanClientMDnsSrvUuidInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    CsrBtUuid128 mDnsSrvUuid;
} GattXpanClientMDnsSrvUuidInd;

/*!
    0x00 = Bluetooth TWM
    0x01 = Bluetooth LE Audio
    0x02 = XPAN non2.4G P2P
    0x03 = XPAN 2.4G P2P
    0x04 = XPAN non2.4G AP
    0x05 = XPAN 2.4G AP
    Others = Reserved
*/
typedef uint8 GattXpanClientConnectedDevicesTransport;

#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_BT_TWM                  ((GattXpanClientConnectedDevicesTransport) 0x00)
#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_BT_LEA                  ((GattXpanClientConnectedDevicesTransport) 0x01)
#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_XPAN_NON_2_DOT_4_G_P2P  ((GattXpanClientConnectedDevicesTransport) 0x02)
#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_XPAN_2_DOT_4_G_P2P      ((GattXpanClientConnectedDevicesTransport) 0x03)
#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_XPAN_NON_2_DOT_4_G_AP   ((GattXpanClientConnectedDevicesTransport) 0x04)
#define XPAN_CLIENT_CONNECTED_DEVICES_TRANSPORT_XPAN_2_DOT_4_G_AP       ((GattXpanClientConnectedDevicesTransport) 0x05)

typedef struct GattXpanClientTransportDescriptor
{
    /*! Array of transport values, one per connected device (i.e. the array is 'numDevices' in length). */
    GattXpanClientConnectedDevicesTransport    transport;

    /*! Centre frequency (in MHz; whole number only). Only valid if Transport[i] is 0x02 or 0x03 */
    uint16                                 primaryFrequencyMhz;
} GattXpanClientTransportDescriptor;

typedef struct
{
    /* Number of Devices described in this Read Confirm    */
    uint8                          numDevices;

    /*! Array of transport descriptors, one per connected device (i.e. the array is 'numDevices' in length), describing the transport and centre frequency. */
    GattXpanClientTransportDescriptor* transportDescr;

} GattXpanClientConnectedDevices;

typedef struct GattXpanClientConnectedDevicesInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientConnectedDevices connectedDevices;
} GattXpanClientConnectedDevicesInd;

typedef uint8 GattXpanClientClearToSend;

#define XPAN_NOT_READY_TO_ACCEPT_AUDIO_OVER_XPAN             ((GattXpanClientClearToSend) 0x00)
#define XPAN_READY_TO_ACCEPT_AUDIO_OVER_XPAN                 ((GattXpanClientClearToSend) 0x01)

typedef struct GattXpanClientClearToSendInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientClearToSend clearToSend;
} GattXpanClientClearToSendInd;

/*!
        Bearer Preference

        0x00: No preference (default)
        0x01: Bluetooth BR/EDR
        0x02: Bluetooth LE
        0x03: XPAN Access Point
        0x04: XPAN Point to Point
        Others: Reserved
 */
typedef uint8 GattXpanClientBearerPreference;

#define XPAN_CLIENT_BEARER_PREFERENCE_NO_PREFERENCE                         ((GattXpanClientBearerPreference) 0x00)
#define XPAN_CLIENT_BEARER_PREFERENCE_BLUETOOTH_BREDR                       ((GattXpanClientBearerPreference) 0x01)
#define XPAN_CLIENT_BEARER_PREFERENCE_BLUETOOTH_LE                          ((GattXpanClientBearerPreference) 0x02)
#define XPAN_CLIENT_BEARER_PREFERENCE_BLUETOOTH_XPAN_ACCESS_POINT           ((GattXpanClientBearerPreference) 0x03)
#define XPAN_CLIENT_BEARER_PREFERENCE_BLUETOOTH_XPAN_POINT_TO_POINT         ((GattXpanClientBearerPreference) 0x04)

typedef struct GattXpanClientBearerPreferenceInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientBearerPreference bearerPreference;
} GattXpanClientBearerPreferenceInd;

#define XPAN_CLIENT_MAC_ADDRESS_LEN                         6

typedef struct GattXpanClientMacAddressAudioLocationInfo
{
    uint8 macAddress[XPAN_CLIENT_MAC_ADDRESS_LEN];
    uint32 audioLocation;
} GattXpanClientMacAddressAudioLocationInfo;

typedef struct GattXpanClientMacAddresses
{
    uint8 numMacAddresses;                  /*! The number of elements in the array of MAC addresses/Audio location info */
    GattXpanClientMacAddressAudioLocationInfo* macAddressAudioLocationInfo;
} GattXpanClientMacAddresses;

typedef struct GattXpanClientMacAddressInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientMacAddresses macAddresses;
} GattXpanClientMacAddressInd;

typedef uint8 GattXpanClientSapPowerState;
#define XPAN_CLIENT_SAP_POWER_STATE_DEEP_SLEEP                ((GattXpanClientSapPowerState)             0x00)
#define XPAN_CLIENT_SAP_POWER_STATE_ACTIVE                    ((GattXpanClientSapPowerState)             0x01)

typedef uint8 GattXpanClientSapPowerStateRequester;
#define XPAN_CLIENT_SAP_POWER_STATE_REQUESTER_PRIMARY_EB      ((GattXpanClientSapPowerStateRequester)    0x00)
#define XPAN_CLIENT_SAP_POWER_STATE_REQUESTER_SECONDARY_EB    ((GattXpanClientSapPowerStateRequester)    0x01)

typedef struct
{
    GattXpanClientSapPowerState                   state;      /*! Service Access Point Power State */
/* no longer in the QBCESPEC (last checked on 22/09/2022)
    GattXpanClientSapPowerStateRequester          requester;  /! The requester of the SAP Power State information
*/
} GattXpanClientSapPowerStateData;

typedef struct GattXpanClientRequestedSapPowerStateInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientSapPowerStateData sapPowerStateData;
} GattXpanClientRequestedSapPowerStateInd;

#define XPAN_CLIENT_SERVER_FEATURES_LEN                         8

typedef struct GattXpanClientServerFeatures
{
    uint8 value[XPAN_CLIENT_SERVER_FEATURES_LEN];  /* Server Features   8 Octets    Bit 0: XPAN 2.4 GHz bearer
                                                                                    Bit 1: XPAN 5 GHz bearer
                                                                                    Bit 2: XPAN 6 GHz bearer
                                                                                    Bit 3: XPAN point to point topology
                                                                                    Bit 4: XPAN access point topology
                                                                                    Bit 5: XPAN P2P audio bearer
                                                                                    Bit 6: XPAN AP audio bearer
                                                                                    Bit 7: Bearer switch between Bluetooth and 2.4 GHz AP
                                                                                    Bit 8: Bearer switch between Bluetooth and 5 GHz (or higher) AP
                                                                                    Bit 9: Audio bearer switch between Bluetooth and SAP
                                                                                    Bit 10: Bearer switch between 2.4 GHz AP and 5 GHz (or higher) AP
                                                                                    Bit 11: Full bearer switch during an LE audio stream
                                                                                    Bit 12: Switch primary procedure
                                                                                    Bit 13: TLS
                                                                                    Bit 14: DTLS
                                                                                    Bit 15: Voice call over XPAN P2P bearer
                                                                                    Bit 16: mDNS
                                                                                    Others: Reserved
                                                    */
} GattXpanClientServerFeatures;

typedef struct GattXpanClientServerFeaturesInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    GattXpanClientServerFeatures serverFeatures;
} GattXpanClientServerFeaturesInd;

typedef uint8 AudioBearerSwitchResponse;
#define XPAN_CLIENT_READY_TO_PERFORM_AUDIO_BEARER_SWITCH            ((AudioBearerSwitchResponse) 0x00)
#define XPAN_CLIENT_FAILURE_TO_PERFORM_AUDIO_BEARER_SWITCH          ((AudioBearerSwitchResponse) 0x01)

typedef struct GattXpanClientAudioBearerSwitchResponseInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    AudioBearerSwitchResponse audioBearerSwitchResponse;
} GattXpanClientAudioBearerSwitchResponseInd;

typedef uint8 NumDevicesPresent;

typedef struct GattXpanClientNumDevicesPresentInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    NumDevicesPresent numDevices;
} GattXpanClientNumDevicesPresentInd;

typedef uint8 VoiceBackChannelPeriodicity;

typedef struct GattXpanClientVoiceBackChannelPeriodicityInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    VoiceBackChannelPeriodicity periodicity;
} GattXpanClientVoiceBackChannelPeriodicityInd;


typedef struct GattXpanClientRequestWiFiScanResultsInd
{
    GattXpanClientMessageId id;
    ServiceHandle clntHndl;

    /* The RequestWiFiScanResultsInd has no fields in it, it is 'empty' */
} GattXpanClientRequestWiFiScanResultsInd;

/*! @brief Contents of the GATT_XPAN_CLIENT_READ_STORED_SSIDS_CFM message that is sent by the library,
    as a result of reading of the Stored SSIDs characteristic on the server.
 */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    GattXpanClientStoredSsid storedSsid;
} GattXpanClientReadStoredSsidsCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the Ipv4Address characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId            id;
    ServiceHandle                      srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                           status;     /*! Status of the reading attempt. */

    GattXpanClientIpAddressData        ipAddressData;
} GattXpanClientReadIpAddressCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the L2capTcpPort characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    GattXpanClientL2capTcpPort l2capTcpPort;
} GattXpanClientReadL2capTcpPortCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the UdpPort characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    GattXpanClientUdpPort   udpPort;
} GattXpanClientReadUdpPortCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the MDnsSrvUuid characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    CsrBtUuid128            mDnsSvrUuid;
} GattXpanClientReadMDnsSrvUuidCfm;

#define GATT_XPAN_CLIENT_READ_TWT_CONFIG_TRIGGER_TYPE_MASK          0x04
#define GATT_XPAN_CLIENT_READ_TWT_CONFIG_FLOW_TYPE_MASK             0x02
#define GATT_XPAN_CLIENT_READ_TWT_CONFIG_NEGOTIATION_TYPE_MASK      0x01

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the TwtConfiguration characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId    id;
    ServiceHandle              srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                   status;     /*! Status of the reading attempt. */
    GattXpanClientTwtConfiguration twtConfiguration;
} GattXpanClientReadTwtConfigurationCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the ConnectedDevices characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    GattXpanClientConnectedDevices xpanConnectedDevices;
} GattXpanClientReadConnectedDevicesCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the ClearToSend characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */

    GattXpanClientClearToSend clearToSend;
} GattXpanClientReadClearToSendCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the XpanControlPoint characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
} GattXpanClientReadXpanErrorCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the BearerPreference characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */

    GattXpanClientBearerPreference bearerPreference;
} GattXpanClientReadBearerPreferenceCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the MacAddress characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;       /*! Reference handle for the XPAN service. */
    status_t                status;         /*! Status of the reading attempt. */

    GattXpanClientMacAddresses macAddresses;
} GattXpanClientReadMacAddressCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the RequestedSapPowerState characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId           id;
    ServiceHandle                     srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                          status;     /*! Status of the reading attempt. */
    GattXpanClientSapPowerStateData   sapPowerStateData;      /*! Service Access Point Power State data*/
} GattXpanClientReadRequestedSapPowerStateCfm;

typedef struct
{
    GattXpanClientMessageId           id;
    ServiceHandle                     srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                          status;     /*! Status of the reading attempt. */
    GattXpanClientServerFeatures      serverFeatures;  /*! */
} GattXpanClientReadServerFeaturesCfm;

typedef struct
{
    GattXpanClientMessageId           id;
    ServiceHandle                     srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                          status;     /*! Status of the reading attempt. */
    AudioBearerSwitchResponse         audioBearerSwitchResponse;
} GattXpanClientReadAudioBearerSwitchResponseCfm;

typedef struct
{
    GattXpanClientMessageId           id;
    ServiceHandle                     srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                          status;     /*! Status of the reading attempt. */
    NumDevicesPresent                 numDevices; /*! Number of devices present*/
} GattXpanClientReadNumDevicesPresentCfm;

typedef struct
{
    GattXpanClientMessageId           id;
    ServiceHandle                     srvcHndl;     /*! Reference handle for the XPAN service. */
    status_t                          status;       /*! Status of the reading attempt. */
    VoiceBackChannelPeriodicity       periodicity;  /*! Periodicity of voice back channel packets, in milliseconds*/
} GattXpanClientReadVoiceBackChannelPeriodicityCfm;

#define XPAN_CLIENT_READ_CCC_VALUE_SIZE          0x02
/*! @brief Contents of the GATT_XPAN_CLIENT_XXX_CFM message that is sent by the library,
    as a result of reading of a generic 'Ccc' characteristic on the server. */
typedef struct
{
    GattXpanClientMessageId id;
    ServiceHandle           srvcHndl;   /*! Reference handle for the XPAN service. */
    status_t                status;     /*! Status of the reading attempt. */
    uint16                  sizeValue;  /*! Value size*/
    uint8                   value[XPAN_CLIENT_READ_CCC_VALUE_SIZE];   /*! Read value */
} GattXpanClientGenericReadCccCfm;

/*! @brief Contents of the GATT_XPAN_CLIENT_<StoredSsidCcc>_CFM message that is sent by the library,
    as a result of reading of the storedSsidCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadStoredSsidCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<Ipv4AddressCcc>_CFM message that is sent by the library,
    as a result of reading of the Ipv4AddressCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadIpv4AddressCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the Ipv6AddressCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadIpv6AddressCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the L2capTcpPortCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadL2capTcpPortCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the UdpPortCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadUdpPortCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the ConnectedDevicesCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadConnectedDevicesCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the ClearToSendCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadClearToSendCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the XpanControlPointCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadXpanControlPointCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the BearerPreferenceCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadBearerPreferenceCccCfm;


/*! @brief Contents of the GATT_XPAN_CLIENT_<TODO>_CFM message that is sent by the library,
    as a result of reading of the RequestedSapPowerStateCcc characteristic on the server. */
typedef GattXpanClientGenericReadCccCfm GattXpanClientReadRequestedSapPowerStateCccCfm;

/* Write CFM messages */
/*! @brief Contents of the GATT_XPAN_CLIENT_WRITE_<>_CFM message that is sent by the library,
    as a result of writing the XPAN Control point characteristic on the server.
*/
typedef struct
{
    GattXpanClientMessageId id;  /*! service message id */
    ServiceHandle clntHndl;      /*! Reference handle for the instance */
    status_t status;             /*! Status of the setting attempt */
} GattXpanClientGenericWriteReqCfm;

/*!
    @brief Gatt client library message sent as a result of calling the GattXpanClientTerminateReq API.

    NOTE : This confirm describes all the handles used by the XPAN client
*/
typedef struct
{
    GattXpanClientMessageId  id;                             /*! service message id */
    ServiceHandle      clntHndl;                             /*! Reference handle for the instance */
    GattXpanClientStatus  status;                            /*! Status of the termination
                                                                 attempt */
    uint16                startHandle;                       /*! Start handle of XPAN */
    uint16                endHandle;                         /*! End handle of XPAN */

    GattXpanClientDeviceData handles;                     /*! Handles of the XPAN
                                                                 characteristics and of their
                                                                 Client Characteristic Configurations */
} GattXpanClientTerminateCfm;

/*!
    @brief This API is used to write the client characteristic configuration of a
    characteristic on a remote device, to enable notifications with the server.
    An error will be returned if the server does not support notifications.

    @param clntHndl            The service handle for this GATT Client Service.
    @param charId              The id of the characteristic being acted on.
    @param notificationsEnable Set to TRUE to enable notifications on the server, FALSE to disable them.

    NOTE: A GATT_XPAN_CLIENT_XXX_SET_NTF_CFM message will be sent to the registered application Task.
*/
void GattXpanClientRegisterForNotificationReq(ServiceHandle clntHndl, XpanClientCharacteristicId charId, bool notificationsEnable);

void GattXpanClientReadRequest(ServiceHandle serviceHandle, XpanClientCharacteristicId charId);
void GattXpanClientReadRequestCcc(ServiceHandle serviceHandle, XpanClientCharacteristicId charId);

void GattXpanClientWriteControlPointConnectSsidReq(const ServiceHandle clntHndl, GattXpanClientConnectSsidOp* connectSsidOp);
void GattXpanClientWriteControlPointDisconnectSsidReq(const ServiceHandle clntHndl, GattXpanClientDisconnectSsidOp* disconnectSsidOp);
void GattXpanClientWriteControlPointConnectedSsidReq(const ServiceHandle clntHndl, GattXpanClientConnectedSsidOp* connectedSsidOp );
void GattXpanClientWriteControlPointAvailableSsidReq(const ServiceHandle clntHndl, GattXpanClientAvailableSsidOp* availableSsidOp );
void GattXpanClientWriteControlPointRelatedSsidsReq(const ServiceHandle clntHndl, GattXpanClientRelatedSsidsOp* relatedSsidsOp );
void GattXpanClientWriteControlPointMdnsSrvUuidReq(const ServiceHandle clntHndl, GattXpanClientMdnsSrvUuidOp* mdnsSrvUuidOp );
void GattXpanClientWriteControlPointRemoveSsidReq(const ServiceHandle clntHndl, GattXpanClientRemoveSsidOp* removeSsidOp );
void GattXpanClientWriteControlPointL2capTcpPortReq(const ServiceHandle clntHndl, GattXpanClientL2capTcpPortOp* l2capTcpPortOp );
void GattXpanClientWriteControlPointUdpPortReq(const ServiceHandle clntHndl, GattXpanClientUdpPortOp* udpPortOp );
void GattXpanClientWriteControlPointEtherTypeReq(const ServiceHandle clntHndl, GattXpanClientEtherTypeOp* etherTypeOp );
void GattXpanClientWriteControlPointMacAddressReq(const ServiceHandle clntHndl, GattXpanClientMacAddressOp* macAddressOp );
void GattXpanClientWriteControlPointBearerPreferenceResponseReq(const ServiceHandle clntHndl, GattXpanClientBearerPreferenceResponseOp* bearerPreferenceResponseOp );
void GattXpanClientWriteControlPointUpdateBeaconParametersReq(const ServiceHandle clntHndl, GattXpanClientUpdateBeaconParametersOp* updateBeaconParametersOp );
void GattXpanClientWriteControlPointSapPowerStateResponseReq(const ServiceHandle clntHndl, GattXpanClientSapPowerStateResponseOp* sapPowerStateResponseOp );
void GattXpanClientWriteControlPointClientFeaturesReq(const ServiceHandle clntHndl, GattXpanClientClientFeaturesOp* clientFeaturesOp );
void GattXpanClientWriteControlPointAudioBearerSwitchRequestReq(const ServiceHandle clntHndl, GattXpanClientAudioBearerSwitchRequestOp* audioBearerSwtichRequestOp );
void GattXpanClientWriteTwtConfigurationReq(const ServiceHandle clntHndl, GattXpanClientTwtConfiguration* twtConfiguration);
void GattXpanClientWriteControlPointWiFiScanResultsReq(const ServiceHandle clntHndl, GattXpanClientWiFiScanResultsOp* wiFiScanResultsOp);
void GattXpanClientWriteControlPointChannelSwitchAnnouncementReq(const ServiceHandle clntHndl, GattXpanClientChannelSwitchAnnouncementOp* channelSwitchAnnouncementOp);
void GattXpanClientWriteControlPointUdpSyncPortReq(const ServiceHandle clntHndl, GattXpanClientUdpSyncPortOp* udpSyncPortOp);
void GattXpanClientWriteControlPointRoamingRequestReq(const ServiceHandle clntHndl);
void GattXpanClientWriteControlPointMulticastMacAddressReq(const ServiceHandle clntHndl, GattXpanClientMulticastMacAddressOp* multicastMacAddress);

void GattXpanClientTerminateTwtSession(const ServiceHandle clntHndl);
void GattXpanClientTerminateReq(ServiceHandle clntHndl);

/*!
    @brief GATT XPAN Client Service Initialisation Request.

    @param theAppTask  The client task that will receive messages from this library.
    @param initData    Configuration data for client initialisation.
    @param deviceData  Cached handles/data from previous connection with Peer Device or
                       NULL if this is the first time this peer device has connected.

    NOTE: GATT_XPAN_CLIENT_INIT_CFM will be received with a GattXpanClientStatus status code.
*/
void GattXpanClientInitReq(AppTask theAppTask,
                           const GattXpanClientInitData   *const initData,
                           const GattXpanClientDeviceData *deviceData);




#endif /* EXCLUDE_GATT_XPAN_CLIENT_MODULE */
#endif /* GATT_XPAN_CLIENT_H */

